/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Controllayer;
import Modellayer.*;
import java.util.*;
import DBlayer.*;
/**
 *
 * @author Michael
 */
public class CustomerCtr
{

	public CustomerCtr()
	{
	}

	public ArrayList findAllCustomers()
    {
		IFDBCustomer dbCustomer = new DBCustomer();
        ArrayList allCustomer = new ArrayList();
        allCustomer = dbCustomer.getAllCustomers(false);
        return allCustomer;
    }

	public Customer findCustomer(int ID, boolean retrieveAssociation)
	{
		IFDBCustomer dbCustomer = new DBCustomer();
        return dbCustomer.findCustomer(ID, retrieveAssociation);
	}

	public int updateCustomer(String name, String Address, int phoneNo, int odeZipC)
      {
          IFDBCustomer dbCustomer = new DBCustomer();
          Customer customer = new Customer();
          customer.setName(name);
		  customer.setAddress(Address);
		  customer.setPhoneno(phoneNo);
		  customer.setCity(new City(odeZipC));
          return  dbCustomer.updateCustomer(customer);
      }

	 public void insertNew(Customer customerObj)
      {
           IFDBCustomer dbCustomer = new DBCustomer();
           dbCustomer.insertCustomer(customerObj);
      }

	 public void deleteCustomer(int ID)
	{
            IFDBCustomer dbCustomer = new DBCustomer();
            dbCustomer.delete(ID);
	}


}
